package com.example.provider;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.*;

/**
 * @author Gao
 * @date 2021/7/15
 */
@RestController
@RefreshScope
public class ProviderController {

    @Value("${config.appName}")
    private String appName;

    @Value("${username}")
    private String username;

    @RequestMapping(value = "/user-api/echo/{id}", method = RequestMethod.GET)
    public String echo(@PathVariable String id) {
        System.out.println("provider服务的方法。。");
        return "Hello Nacos Discovery111 " + id;
    }

    @GetMapping("/user-api/config/test")
    public String configTest() {
        String s = "appName: " + appName + " username: " + username;
        System.out.println(s);
        return s;
    }
}
